package com.ruijixiang.leetcode.everyday.leetcode2024.leetcode202411;

public class leetcode20241101 {
    public long maxEnergyBoost(int[] energyDrinkA, int[] energyDrinkB) {
        int n=energyDrinkA.length;
        long[][] dp=new long[n+2][2];
        for(int i=0;i<n;i++){
            dp[i+2][0]=Math.max(dp[i+1][0],dp[i][1])+energyDrinkA[i];
            dp[i+2][1]=Math.max(dp[i+1][1],dp[i][0])+energyDrinkB[i];
        }
        return Math.max(dp[n+1][0],dp[n+1][1]);
    }
}
